package cn.gson.springboot.controller;

import cn.gson.springboot.model.pojos.Customer;
import cn.gson.springboot.model.service.CustomerViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class CustomerViewController {
    @Autowired
    CustomerViewService CustomerViewService;
    @RequestMapping("/customer-id")
    @ResponseBody
    public Customer CustomerList(Integer customerId, HttpSession session) {
        //Customer cus = (Customer) session.getAttribute("cus");
        Customer customer = CustomerViewService.selectCustomerById(customerId);
        System.out.println(customer);
        return customer;
    }
}
